package com.itheima.mall.commons;

import lombok.Data;

import java.io.Serializable;

@Data
public class R implements Serializable {
    private Integer code;
    private String string;
    private Object data;
    public R(Integer code, java.lang.String string, Object data) {
        this.code = code;
        this.string = string;
        this.data = data;
    }

    public R(Integer code, java.lang.String string) {
        this.code = code;
        this.string = string;
    }

    public static R ok(Object data) {
        return new R(Code.SUCCESS, "操作成功", data);
    }

    public static R err(String msg) {
        return new R(Code.BAD_REQUEST, msg);
    }
}
